import React, { Component } from 'react'
import { BrowserRouter, Switch, Route } from 'react-router-dom'
import routes from './routes'

export default class RouterView extends Component {
  render() {
    return (
      <BrowserRouter>
        <Switch>
          {routes.map(route => (
            <Route
              key={route.path}
              path={route.path}
              exact={route.exact}
              render={props => {
                return (
                  <route.component
                    {...props}
                    routeChildren={route.routeChildren}
                  ></route.component>
                )
              }}
            ></Route>
          ))}
        </Switch>
      </BrowserRouter>
    )
  }
}
